package 代码记录.指定公司代码练习记录.华为_2024.分值100;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;

/**
 * @author zx
 * @create 2024-02-02 20:09
 * 人家的暴力解法思路，自己稍微做了修改
 */
public class 整数分解_31 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int t = sc.nextInt();
        if (t < 1 || t > 1000) {
            System.out.println("input error");
            return;
        }
        List<String> resultList = new ArrayList<>();
        for (int i = 1; i <= t; i++) {
            int total = 0;
            StringBuilder sb = new StringBuilder();
            for (int j = i; total <= t; j++) {
                total += j;
                if (t == total) {
                    sb.append(j);
                    resultList.add(t + "=" + sb);
                    break;
                }
                sb.append(j).append("+");
            }
        }
        resultList.sort(Comparator.comparingInt(String::length));
        resultList.forEach(System.out::println);
        System.out.println("Result:" + (resultList.size()));
    }
}
